package com.maigao.core.login.handler;

import com.maigao.util.CollectionUtils;
import com.maigao.util.JsonUtil;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author awei
 * @description:
 * @date 2022/5/19 11:56 下午
 */
public class BaseHandler {

    protected Map<String, String> processResult(List<String> list, String requestStr) {
        if (null == requestStr) {
            return null;
        }
        Map<String, String> res = new HashMap<>();

        Map<String, String> sourceMap = JsonUtil.toBean(requestStr, Map.class);
        if (CollectionUtils.isEmpty(sourceMap)) {
            return res;
        }
        for (String str : list) {
            res.put(str, sourceMap.get(str));
        }
        return res;
    }
}
